﻿@{
    ViewBag.Title = "Index";
    ViewBag.Heading = "Tables";
    Layout = "~/Areas/AdminCp/Views/Shared/_WidgetsLayout.cshtml";
}

<script type="text/javascript">
    function validate(form) {
        if (form.firstname.value == "") {
            alert("Please entry your First Name");
            return false;
        }
        if (form.lastname.value == "") {
            alert("Please entry your Last Name");
            return false;
        }
        if (form.select.value == "") {
            alert("Please select your select");
            return false;
        }
        if (form.location.value == "") {
            alert("Location cannot be empty");
            return false;
        }

        var pattern = /^([a-zA-Z0-9_\.\-])+\@@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

        if (pattern.test(form.email1.value)) {
            alert("Please enter your email address");
            return true;
        }

        return true;
    }

</script>

<div class="contenttitle">
                    	<h2 class="form"><span>Simple Form with Validation</span></h2>
                    </div><!--contenttitle-->
                    
                    <br />
                    
<form id="form1" class="stdform" method="post" action="" onsubmit="validate(this)">
    <p>
        <label>First Name</label>
        <span class="field"><input type="text" name="firstname" id="firstname" class="longinput" /></span>
    </p>
                        
    <p>
        <label>Last Name</label>
        <span class="field"><input type="text" name="lastname" id="lastname" class="longinput" /></span>
    </p>
                        
    <p>
        <label>Email</label>
        <span class="field"><input type="text" name="email" id="email" class="longinput" /></span>
    </p>
                        
    <p>
        <label>Location</label>
        <span class="field"><textarea cols="80" rows="5" name="location" class="mediuminput" id="location"></textarea></span> 
    </p>
                        
    <p>
        <label>Select</label>
        <span class="field">
            <select name="select" id="selection">
                <option value="">Choose One</option>
                <option value="1">Selection One</option>
                <option value="2">Selection Two</option>
                <option value="3">Selection Three</option>
                <option value="4">Selection Four</option>
            </select>
        </span>
    </p>
                        
    <br />
                        
    <p class="stdformbutton">
        <button class="submit radius2">Submit Button</button>
    </p>
</form>
